package weeklyreport

class User {
	
	String name
	String company
	String password
	String role
	
	static hasMany = [issues:Issue, tasks:Task]

    static constraints = {
    	name(blank:false,nullable:false,unique:true)
		company(blank:true,nullable:true)
		password(blank:true,nullable:true,password:true)
		role(inList:["admin", "user"])
	}
	
	static transients = ["admin","user"]
	
	boolean isAdmin() {
		return role == "admin"
	}
	
	boolean isUser() {
		return role == "user"
	}
	
	String toString() {
		name
	}
}
